package fr.insta.browser;


import fr.insta.browser.container.Container;
import fr.insta.browser.view.frame.MainFrame;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import javax.swing.SwingUtilities;



/**
 * <p>Main class.</p>
 *
 * @author Maarek
 * @version $Id: $Id
 */
public class Main {

    private static void connectProxy() {
        final String authUser = "etudiant";
        final String authPassword = "etudiant";
        Authenticator.setDefault(
                new Authenticator() {
                    @Override
                    public PasswordAuthentication getPasswordAuthentication() {
                        return new PasswordAuthentication(
                                authUser, authPassword.toCharArray());
                    }
                }
        );

        System.setProperty("http.proxyHost", "172.16.13.3");
        System.setProperty("http.proxyPort", "8080");
    }

    /**
     * <p>main.</p>
     *
     * @param args an array of {@link java.lang.String} objects.
     */
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                if (System.getProperty("os.name").contains("Mac")) {
                    System.setProperty("apple.laf.useScreenMenuBar", "true");
                }

                Look look = new Look();
                look.init();
                connectProxy();

                Container container = new Container();

                MainFrame frame = container.getMainFrame();
                frame.setSize(frame.getPreferredSize());
                frame.setVisible(true);
            }
        });
    }
}
